#! /bin/bash

chmod_dir=(
		/srv/result
		/srv/es/logging-es
		/srv/es
		/srv/cache/netdata_cache
		/srv/cache/netdata_lib
		/srv/cci/serial/logs
		/srv/cci/libvirt-xml
		/srv/cci/serial/fluentd-pos
		/srv/cci/Maildir
		/srv/rabbitmq
		/c/git-repos
		/srv/tmp/public
		/srv/initrd
		/srv/initrd/pkg
		/srv/initrd/deps
		/srv/upload-files
		/etc/compass-ci
		/etc/compass-ci/accounts
		/etc/compass-ci/defaults
		/etc/compass-ci/service
		/etc/compass-ci/scheduler
		/etc/compass-ci/register
		/etc/compass-ci/dnsmasq
)

chmod 775 "${chmod_dir[@]}"

chown_dir=(
		/srv/result
		/srv/initrd
		/srv/initrd/pkg
		/srv/initrd/deps
		/srv/es
		/srv/cache/netdata_cache
		/srv/cache/netdata_lib
		/srv/cci/serial/fluentd-pos
		/srv/cci/libvirt-xml
		/srv/rabbitmq
		/srv/tmp/public
		/srv/upload-files
)

chown lkp:lkp "${chown_dir[@]}"

chown lkp:committer /srv/git
chown lkp:committer /c/git-repos
chown mailer:team /srv/cci/Maildir

chgrp team /srv/cci/serial/logs
chgrp team /srv/dc

chmod g+ws /srv/dc

find /tftpboot -type d | xargs chmod 775
